home *** CD-ROM | disk | FTP | other *** search
/ IRIX Installation Tools & Overlays 2002 November / SGI IRIX Installation Tools & Overlays 2002 November - Disc 4.iso / dist / infosearch.idb / usr / lib / infosearch / bin / relnote2html.z / relnote2html
Text File  |  2002-10-15  |  3KB  |  122 lines

  1. #!/usr/bin/perl
  2. #
  3. # Copyright 1996-2002, Silicon Graphics, Inc.
  4. # All Rights Reserved.
  5. #
  6. # This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  7. # the contents of this file may not be disclosed to third parties, copied or
  8. # duplicated in any form, in whole or in part, without the prior written
  9. # permission of Silicon Graphics, Inc.
  10. #
  11. # RESTRICTED RIGHTS LEGEND:
  12. # Use, duplication or disclosure by the Government is subject to restrictions
  13. # as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  14. # and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  15. # successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  16. # rights reserved under the Copyright Laws of the United States.
  17. #
  18. #  ------------
  19. #  relnote2html
  20. #  ------------
  21. #  filter release notes into HTML
  22. #
  23. #  Usage:
  24. #       relnote2html [-r <root>]  [-h <highlight_str>]  /<standard_path>/<file>
  25. #       relnote2html [-r <root>]  [-h <highlight_str>]  TC <product>
  26. #       relnote2html [-r <root>]  [-h <highlight_str>]  <product>
  27. #
  28. #  requires perl5 and relnote2html.pl
  29. #
  30.  
  31. $| = 1;
  32.  
  33. use strict;
  34.  
  35. # globals
  36. #
  37. package InfoSearch;
  38.  
  39. $InfoSearch::COLLECTION = $ENV{'COLLECTION'};
  40. $InfoSearch::_TR        = $ENV{'TOOLROOT'};
  41. $InfoSearch::_WEB       = ($ENV{'REQUEST_METHOD'} ne '' ? 1 : 0);
  42. $InfoSearch::_DB        = 'relnote';
  43.  
  44. require 'relnote2html.pl';
  45.  
  46. &main(@ARGV);
  47. exit(0);
  48.  
  49.  
  50.  
  51. #######################################################################
  52. #
  53. # void main()
  54. #
  55. #######################################################################
  56.  
  57. sub main {
  58.  
  59.   my(@argv) = @_;
  60.   unless ($argv[0]) {
  61.         print "relnote2html: no arguments" if (${InfoSearch::_WEB} == 0);
  62.         return;
  63.   }
  64.  
  65.   my($fname, $rn_root, $srch_str) = '';
  66.   my($i) = 0;
  67.   while($i < (@argv + 0)) {
  68.  
  69.         if ($argv[$i] eq "-h") {
  70.  
  71.            splice(@argv, $i, 1);
  72.            if( $argv[$i] ne '' ) {
  73.                $srch_str = $argv[$i];
  74.                splice(@argv, $i, 1);
  75.            }
  76.  
  77.         } elsif ($argv[$i] eq "-r") {
  78.  
  79.            splice(@argv, $i, 1);
  80.            if( $argv[$i] ne '' ) {
  81.                $rn_root = $argv[$i];
  82.                splice(@argv, $i, 1);
  83.            }
  84.  
  85.         } else {
  86.  
  87.            $i++;
  88.         }
  89.   }
  90.  
  91.   # take whatever is left
  92.   #
  93.   $fname = join(' ', @argv);
  94.  
  95.  
  96.   #  Set the path for security and taint checking.
  97.   #
  98.   $ENV{'PATH'} = "${InfoSearch::_TR}/usr/sbin:" .
  99.                  "${InfoSearch::_TR}/usr/bin:"  .
  100.                  "${InfoSearch::_TR}/bin:/usr/sbin:/usr/bin:/bin";
  101.  
  102.  
  103.   # check (again!)
  104.   #
  105.   my($OK_CHARS) = "-a-zA-Z0-9_.*\@,:;()\ \+\/";
  106.   $fname =~ s/[^$OK_CHARS]//go;
  107.   if( $fname =~ /\.\./ || $fname =~ /^\/etc/ || $fname =~ /\&/
  108.       ||
  109.       $fname =~ /\;/ || $fname =~ /\|/ || $fname =~ /\,/
  110.       ||
  111.       $fname =~ /\>/ || $fname =~ /\</ ) {
  112.  
  113.       print "relnote2html: Illegal document access" if (${InfoSearch::_WEB} == 0);
  114.       return;
  115.   }
  116.  
  117.   &relnotes2html($rn_root, $fname, $srch_str);
  118.  
  119.   return;
  120. }
  121.  
  122.